import { createStore } from 'vuex'

export default createStore({
  state: {
    user: null,
    projects: [],
    currentProject: null,
    testCases: [],
    reports: []
  },
  mutations: {
    SET_USER(state, user) {
      state.user = user
    },
    SET_PROJECTS(state, projects) {
      state.projects = projects
    },
    SET_CURRENT_PROJECT(state, project) {
      state.currentProject = project
    },
    SET_TEST_CASES(state, testCases) {
      state.testCases = testCases
    },
    SET_REPORTS(state, reports) {
      state.reports = reports
    }
  },
  actions: {
    setUser({ commit }, user) {
      commit('SET_USER', user)
    },
    setProjects({ commit }, projects) {
      commit('SET_PROJECTS', projects)
    },
    setCurrentProject({ commit }, project) {
      commit('SET_CURRENT_PROJECT', project)
    },
    setTestCases({ commit }, testCases) {
      commit('SET_TEST_CASES', testCases)
    },
    setReports({ commit }, reports) {
      commit('SET_REPORTS', reports)
    }
  },
  modules: {
  }
})